package com.emm.yixun.common.response;

import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;

@XmlRootElement
public class ResponseList<T> extends BaseResult {

	private static final long serialVersionUID = 3406063881036445229L;

	private List<T> entity;

	public List<T> getEntity() {
		return entity;
	}

	public void setEntity(List<T> entity) {
		this.entity = entity;
	}

	public ResponseList<T> success() {
		setSuccess(true);
		return this;
	}

	public void success(List<T> entity) {
		setSuccess(true);
		setEntity(entity);
	}

	public ResponseList<T> fail() {
		setSuccess(false);
		return this;
	}

	public void fail(String errorcode, String message) {
		setSuccess(false);
		setErrorCode(errorcode);
		setResultMessage(message);
	}

}
